#include "Controller.h"
#include "Resource.h"


using namespace cocos2d;

void Controller::runScene(int nIdx)
{
    CCDirector::sharedDirector()->purgeCachedData();

    BaseScene* pScene = NULL;

    switch (nIdx)
    {
	case MENU_SCENE:
		pScene = new MenuScene(); 
		break;
    case PLAY_SCENE:
		pScene = new PlayScene(); 
		break;
    
    default:
        break;
    }
	
	if(pScene == NULL)
	{
		return;
	}


	CCDirector * director = CCDirector::sharedDirector();
	if(director->getRunningScene())
	{
		director->replaceScene(pScene);
	}
	else
	{
		director->runWithScene(pScene);
	}

}


